<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="com.biz.utils.ConfigUtil" %>
	<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
    String resoursUrl = ConfigUtil.get("RESOURCES_URL");
%>

<!doctype html>
<html class="no-js"  style=" background: -webkit-gradient(linear, 0% 0%, 0% 100%,from(#FFFFFF), to(#FFFFFF)); padding-bottom:50px;">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>个人中心</title>
<meta name="description" content="">
<meta name="keywords" content="">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<meta name="format-detection" content="telephone=no" />
	<link rel="stylesheet" href="<%=resoursUrl%>resources/assets/css/dxy.css" />
	<link rel="stylesheet" href="<%=resoursUrl%>resources/assets/css/NnOrange.css" />
  <jsp:include page="/jsp/inc_head.jsp"></jsp:include>
<style>
	.jlqspanorange{
		background-color:#ff9f09;
		color:#fff;
		border-radius:4px;
		display:inline-block;
		padding:0 3px;
		font-size:12px;
	}
</style>
</head>

<body class="" style="padding-bottom:55px;">
<div class="am-g centertop">
	<div class="am-u-am-12 centerxx">
		<img  id="headWX" src="" class="centertx"/>
		<span class="centerName" id="name"></span>
		<span class="centerTel" id="userPhone"></span>
		<%--<a onclick="toMyQRCode()" style="float: right;color: #fff;">我的二维码</a>--%>
	</div>
	<div class="am-u-am-12 am-pad-none centerNum">
		<div class="am-u-sm-6 am-text-center bgshu">
			<div class=""><span class="Nummoney" id="ljje">0.00</span></div>
			<div>累计久零券</div>
		</div>
		<div class="am-u-sm-6 am-text-center">
			<div class=""><span class="Nummoney" id="dqye">0.00</span></div>
			<div>久零券余额</div>
		</div>
	</div>
</div>
<div class="fenge clear"></div>
<div class="am-g">
	<div class="am-u-sm-12">
		<div class="am-u-sm-12 am-pad-none allorder">
			<div class="am-u-sm-6 am-pad-none odtext">
				全部订单
			</div>
			<a onclick="toMyOrder()">
				<div class="am-u-sm-6 am-pad-none am-text-right odlink">
					查看全部订单&nbsp;&nbsp;<img src="<%=resoursUrl%>resources/assets/image/icon-right.png" height="12" style="margin-top:-2px;" />
				</div>
			</a>
		</div>
		<div class="am-u-sm-12 am-text-center am-pad-none odState">
			<a onclick="toMyOrderForState(0)">
				<div class="am-u-sm-3 am-pad-none stateLie">
					<img src="<%=resoursUrl%>resources/assets/image/icon-dfk.png"/><br/>
					待付款<span class="stateNum" id="dfk"></span>
				</div>
			</a>
			<a onclick="toMyOrderForState(1)">
				<div class="am-u-sm-3 am-pad-none stateLie">
					<img src="<%=resoursUrl%>resources/assets/image/icon-dsh.png"/><br/>
					待收货<span class="stateNum" id="dsh"></span>
				</div>
			</a>
			<a onclick="toMyOrderForState(2)">
				<div class="am-u-sm-3 am-pad-none stateLie">
					<img src="<%=resoursUrl%>resources/assets/image/icon-ywc.png"/><br/>
					已完成<span class="stateNum" id="ywc"></span>
				</div>
			</a>
			<a onclick="toMyOrderForState(3)">
				<div class="am-u-sm-3 am-pad-none stateLie">
					<img src="<%=resoursUrl%>resources/assets/image/icon-tksh.png"/><br/>
					退款售后<span class="stateNum" id="tksh"></span>
				</div>
			</a>
		</div>
	</div>
</div>
<div class="fenge clear"></div>
<div class="am-g">
	<a onclick="toUserInfo()">
		<div class="am-u-sm-12 am-pad-none centerLie">
			<div class="am-u-sm-2 am-text-center am-pad-none">
				<img src="<%=resoursUrl%>resources/assets/image/icon-hyzl.png"/>
			</div>
			<div class="am-u-sm-10 am-pad-none undline">
				会员资料
			</div>
		</div>
	</a>
	<a onclick="toAddress()">
		<div class="am-u-sm-12 am-pad-none centerLie">
			<div class="am-u-sm-2 am-text-center am-pad-none">
				<img src="<%=resoursUrl%>resources/assets/image/icon-shgl.png"/>
			</div>
			<div class="am-u-sm-10 am-pad-none undline">
                收货地址管理
			</div>
		</div>
	</a>
    <a onclick="toPayCode()">
        <div class="am-u-sm-12 am-pad-none centerLie">
            <div class="am-u-sm-2 am-text-center am-pad-none">
                <img src="<%=resoursUrl%>resources/assets/image/icon-jlqzfm.png"/>
            </div>
            <div class="am-u-sm-10 am-pad-none undline">
                久零券支付码
            </div>
        </div>
    </a>
    <a onclick="toDetail()">
        <div class="am-u-sm-12 am-pad-none centerLie">
            <div class="am-u-sm-2 am-text-center am-pad-none">
                <img src="<%=resoursUrl%>resources/assets/image/icon-jlqmx.png"/>
            </div>
            <div class="am-u-sm-10 am-pad-none undline">
                久零券明细
            </div>
        </div>
    </a>
	<a onclick="toRecord()">
		<div class="am-u-sm-12 am-pad-none centerLie">
			<div class="am-u-sm-2 am-text-center am-pad-none">
				<img src="<%=resoursUrl%>resources/assets/image/icon-tydfwf.png"/>
			</div>
			<div class="am-u-sm-10 am-pad-none undline">
				体验店服务费记录
			</div>
		</div>
	</a>
	<a onclick="toRecharegCard()">
		<div class="am-u-sm-12 am-pad-none centerLie">
			<div class="am-u-sm-2 am-text-center am-pad-none">
				<img src="<%=resoursUrl%>resources/assets/image/icon-jlczk.png"/>
			</div>
			<div class="am-u-sm-10 am-pad-none undline">
				久零券充值卡
			</div>
		</div>
	</a>
    <%--<c:if test="${type==1}">--%>
        <%--<a onclick="toGetCard()">--%>
            <%--<div class="am-u-sm-12 am-pad-none centerLie">--%>
                <%--<div class="am-u-sm-2 am-text-center am-pad-none">--%>
                    <%--<img src="<%=Const.RESOURCES_URL%>resources/assets/image/icon-jlqmx.png"/>--%>
                <%--</div>--%>
                <%--<div class="am-u-sm-10 am-pad-none undline">--%>
                    <%--扫码消券--%>
                <%--</div>--%>
            <%--</div>--%>
        <%--</a>--%>
    <%--</c:if>--%>
    <a onclick="toQuery()">
        <div class="am-u-sm-12 am-pad-none centerLie">
            <div class="am-u-sm-2 am-text-center am-pad-none">
                <img src="<%=resoursUrl%>resources/assets/image/icon-cjwt.png"/>
            </div>
            <div class="am-u-sm-10 am-pad-none undline">
                常见问题解答
            </div>
        </div>
    </a>
</div>
<!--footer-->
<jsp:include page="/jsp/inc_bottom.jsp"></jsp:include>
<!--footer-->
<div class="am-modal am-modal-alert" tabindex="-1" id="my-alert">
	<div class="am-modal-dialog">
		<div class="am-modal-hd" id="alert_title">哎呦喂，出错啦</div>
		<div class="am-modal-bd" id="alert_message"></div>
		<div class="am-modal-footer">
			  <span class="am-modal-btn">确定</span>
		</div>
	</div>
</div>
<script>
    var ajaxpath="${pageContext.request.contextPath}";
    $(function() {
		loadUserInfo();
		loadJNInfo();
		loadMyOrderNumber();

		var site_url = window.document.location.href;
        var appid='${appid}';
        /* $.post("wx_js.do", {url: site_url,appid:appid}, function(data) {
            wx.config({
                debug : false, // 开启调试模式,调用的所有api的返回值会在客户端alert出来，若要查看传入的参数，可以在pc端打开，参数信息会通过log打出，仅在pc端时才会打印。
                appId : data.jsData.appid, // 必填，公众号的唯一标识
                timestamp : data.jsData.timestamp, // 必填，生成签名的时间戳
                nonceStr : data.jsData.nonceStr, // 必填，生成签名的随机串
                signature : data.jsData.signature,// 必填，签名
                jsApiList : [ 'checkJsApi', 'scanQRCode', 'chooseImage',
                    'uploadImage' ]
                // 必填，需要使用的JS接口列表，所有JS接口列表见附录2
            });
            wx.ready(function() {
                // 1 判断当前版本是否支持指定 JS 接口，支持批量判断
                wx.checkJsApi({
                    jsApiList : [ 'scanQRCode', ],
                    success : function(res) {
                        if (res.checkResult.scanQRCode == false) {

                        }
                    }
                });
                wx.error(function(res) {
                    //alert("错误:"+res);
                });
            });
        }); */
    });

     function loadUserInfo()
	 { //查询用户信息
		 var url=ajaxpath+"/userCenter/getUserCenterInfo.do";
		 $.get(url,function(data){
			 if(data==null||data==""){
				 $("#alert_message").html("绑定信息有误，请联系客服！");
				 $("#my-alert").modal('open');
			 }else{
				 if(data.personName==""||data.personName==null){
					 $("#name").html(" ");
				 }else{
					 $("#name").html(data.personName);
				 }
				 if(data.phone==""||data.phone==null){
					 $("#userPhone").html(" ");
				 }else{
					 var phone=data.phone;
					 if(phone.length>10)
					 {
					 phone=phone.substring(0,3)+'****'+phone.substring(phone.length-4,phone.length);
					 }
					 else
					 {phone=phone.substring(0,1)+"*****";}
					 $("#userPhone").html(phone);
				 }
				 if(data.birthDay==""||data.birthDay==null){
				 }else{
					 $("#userBir").html(data.birthDay);
				 }

				 if(data.headimgurl==""||data.headimgurl==null){
					 $("#headWX").attr("src","<%=resoursUrl%>resources/assets/image/grcenter_tx.png");
				 }else{
					 $("#headWX").attr("src",data.headimgurl);
				 }
			 }
		 });
	 }
	 //查询用户90网信息
	 function loadJNInfo()
	 {
		 var url=ajaxpath+"/userCenter/getUserCenterJNInfo.do";
		 $.get(url,function(data){
			if(data.return_data!=undefined&&data.return_data!=null)
			{
				$("#xfcs").html(data.return_data.pay_cnt_90);
				$("#ljje").html((data.return_data.balance_90_total/100).toFixed(2));
				$("#dqye").html((data.return_data.balance_90/100).toFixed(2));
			}
		 });
	 }

//查询用户订单数量
	 function loadMyOrderNumber()
	 {
		 var url=ajaxpath+"/order/getUserOrderNum.do";
		 $.get(url,function(data){
			var res=JSON.parse(data);
			 $("#dfk").html(res.dfk);
			 $("#dsh").html(res.dsh);
			 $("#ywc").html(res.ywc);
			 $("#tksh").html(res.tksh);
		 });
	 }
     //跳转个人资料页
     function toMyInfo(){
           window.location.href = ajaxpath+"/client_toClientInfo.do?guid="+ new Date(); 
     }
     //跳转我的账号页
     function toMyAccount(){
           window.location.href = ajaxpath+"/client_toAccountband.do?guid="+ new Date(); 
     }
     //跳转我的优惠券页
     function toMycoupons(){
           window.location.href = ajaxpath+"/client_toMycoupons.do?guid="+ new Date(); 
     }
     //跳转我的收藏页
     function toMycollection(){
           window.location.href = ajaxpath+"/client_toMycollection.do?guid="+ new Date(); 
     }
     //跳转收获地址
     function toAddress(){
           window.location.href = ajaxpath+"/client_toAddress.do?guid="+ new Date(); 
     }
     //跳转会员等级
     function toMemberRating(){
           window.location.href = ajaxpath+"/client_toMemberRating.do?guid="+ new Date(); 
     }
     //跳转我的积分
     function toMyIntegral(){
           window.location.href = ajaxpath+"/client_toMyIntegral.do?guid="+ new Date(); 
     }
	 //跳转我的生日
	 function toBirthDay(){
		 window.location.href = ajaxpath+"/client_toBirthDay.do?guid="+ new Date();
	 }
     //跳转我订单
     function toMyOrder(){
           window.location.href = ajaxpath+"/jsp/order/orderList.jsp?guid="+ new Date();
     }
     //跳转我订单
     function toMyOrderForState(state){
         window.location.href = ajaxpath+"/jsp/order/orderList.jsp?state="+state+"&guid="+ new Date();
     }
	 //跳转90明细
	 function toDetail(){
		 window.location.href = ajaxpath+"/jsp/client/detail_90_orange.jsp?guid="+ new Date();
	 }
	 //跳转90体验店记录
	 function toRecord(){
		 window.location.href = ajaxpath+"/jsp/client/record_90_orange.jsp?guid="+ new Date();
	 }
	 //跳转充值卡
	 function toRecharegCard(){
		 window.location.href = ajaxpath+"/jsp/client/rechargeCard_90_orange.jsp?guid="+ new Date();
	 }
	 //跳转支付码
	 function toPayCode(){
		 window.location.href = ajaxpath+"/jsp/client/payCode_90_orange.jsp?guid="+ new Date();
	 }
	 //跳转用户资料
	 function toUserInfo(){
		 window.location.href = ajaxpath+"/jsp/client/user_info.jsp?guid="+ new Date();
	 }

    //跳转常见问题
    function toQuery(){
        window.location.href = ajaxpath+"/jsp/client/user_question.jsp?guid="+ new Date();
    }

     //弹出二维码扫描
     function toGetCard(){
             wx.scanQRCode({
                 needResult: 0, // 默认为0，扫描结果由微信处理，1则直接返回扫描结果，
                 scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码，默认二者都有
                 success: function (res) {
                     var result = res.resultStr; // 当needResult 为 1 时，扫码返回的结果
                 }
             });
     }
     
     //我的二维码
     function toMyQRCode(){
            window.location.href = ajaxpath+"/client_MyQrCode.do?guid="+ new Date();
     }
     
     
     
</script>
</body>
</html>
